import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'lib_apple_auth_storage_method_channel.dart';

class AppleLoginResult {
  String userID; //苹果id
  String idToken; //苹果token

  AppleLoginResult(this.userID, this.idToken);
}

abstract class LibAppleAuthStoragePlatform extends PlatformInterface {
  /// Constructs a LibAppleAuthStoragePlatform.
  LibAppleAuthStoragePlatform() : super(token: _token);

  static final Object _token = Object();

  static LibAppleAuthStoragePlatform _instance =
      MethodChannelLibAppleAuthStorage();

  /// The default instance of [LibAppleAuthStoragePlatform] to use.
  ///
  /// Defaults to [MethodChannelLibAppleAuthStorage].
  static LibAppleAuthStoragePlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [LibAppleAuthStoragePlatform] when
  /// they register themselves.
  static set instance(LibAppleAuthStoragePlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<AppleLoginResult?> login() {
    throw UnimplementedError('login() has not been implemented.');
  }

  Future<bool> storage(String fileName, String? content) {
    throw UnimplementedError('storage() has not been implemented.');
  }

  Future<String?> getStorageContent(String fileName) {
    throw UnimplementedError('getStorageContent() has not been implemented.');
  }
}
